Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
iframe receives message from parent window but console.log returns [object MessageEvent]

I'm sending messages from the parent window to the iframe, but when I log the message inside the iframe, it returns [object MessageEvent].

I've tried to parse it with JSON.parse and it produces a parse error, but when I try JSON.stringify it prints the string representation of the message correctly.

Can I access the object without doing JSON.strinfigy?

From the Parent window, I'm not sending JSON string. I'm sending an object.

Below is my code in parent window

frame.contentWindow.postMessage({
  action: 'start', 
  config: {onlyWithImages}
}, '*')

and inside the iframe I've this code

window.addEventListener('message', e => {
  let data = e.data
  console.log(data) //[object MessageEvent]
}
about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda